package kz.pompei.var.instruction;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import kz.pompei.var.atom.Atom;

public class BlockInstruction extends Instruction implements Iterable<LineInstruction> {
  
  private final List<LineInstruction> list = new ArrayList<LineInstruction>();
  
  private Atom start, end;
  
  @Override
  public Iterator<LineInstruction> iterator() {
    return list.iterator();
  }
  
  public List<LineInstruction> getList() {
    return list;
  }
  
  public void addElement(LineInstruction lineInstruction) {
    list.add(lineInstruction);
    lineInstruction.setOwner(this);
  }
  
  public Atom getStart() {
    return start;
  }
  
  public void setStart(Atom start) {
    this.start = start;
  }
  
  public Atom getEnd() {
    return end;
  }
  
  public void setEnd(Atom end) {
    this.end = end;
  }
}
